package com.lora.service;

import com.lora.enums.EquipmentEnum;
import com.lora.service.resolver.*;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("nodeDataResolverFactory")
public class NodeDataResolverFactory extends NodeDataResolverAbstractFactory {

    /**
     * 无线烟感
     */
    @Resource
    private WirelessSmokeFeelResolver wirelessSmokeFeelResolver;

    /**
     * 温湿度
     */
    @Resource
    private TemperaturehumidityResolver temperaturehumidityResolver;

    /**
     * 红外感应器
     */
    @Resource
    private InfraredinductionResolver infraredinductionResolver;

    /**
     * 门磁感器
     */
    @Resource
    private GateMahnetismResolver gateMahnetismResolver;

    /**
     * 人体活动红外探测器
     */
    @Resource
    private HumanActiveInfraredResolver humanActiveInfraredResolver;

    /**
     * 新风控制（空调）
     */
    @Resource
    private FreshAirContolAirConditioningResolver freshAirContolAirConditioningResolver;

    /**
     * 电量仪
     */
    @Resource
    private ElectricityMeterResolver electricityMeterResolver;

    /**
     * 开关量
     */
    @Resource
    private SwitchingValueResolver switchingValueResolver;

    /**
     * UPS
     */
    @Resource
    private UpsResolver upsResolver;

    /**
     * 空调UPS协议
     */
    @Resource
    private AirConditioningUpsResolver airConditioningUpsResolver;
    /**
     * 新风UPS数据解析
     */
    @Resource
    private FreshAirUpsResolver freshAirUpsResolver;

    @Override
    public NodeDataResolver getResolver(EquipmentEnum equipmentEnum) {
        if(equipmentEnum.getValue().equals(EquipmentEnum.WIRELESS_SMOKE_FEEL.getValue())) {
            return wirelessSmokeFeelResolver;
        } else if(equipmentEnum.getValue().equals(EquipmentEnum.TEMPERATURE_HUMIDITY.getValue())) {
            return temperaturehumidityResolver;
        } else if(equipmentEnum.getValue().equals(EquipmentEnum.INFRARED_INDUCTION.getValue())) {
            return infraredinductionResolver;
        } else if(equipmentEnum.getValue().equals(EquipmentEnum.GATE_MAGNETISM.getValue())) {
            return gateMahnetismResolver;
        } else if(equipmentEnum.getValue().equals(EquipmentEnum.HUMAN_ACTIVE_INFRARED.getValue())) {
            return humanActiveInfraredResolver;
        } else if(equipmentEnum.getValue().equals(EquipmentEnum.FRESH_AIR_CONTOL_AIR_CONDITIONING.getValue())) {
            return freshAirContolAirConditioningResolver;
        } else if(equipmentEnum.getValue().equals(EquipmentEnum.ELECTRICITY_METER.getValue())) {
            return electricityMeterResolver;
        } else if(equipmentEnum.getValue().equals(EquipmentEnum.SWITCHING_VALUE.getValue())) {
            return switchingValueResolver;
        } else if(equipmentEnum.getValue().equals(EquipmentEnum.UPS.getValue())) {
            return upsResolver;
        } else if(equipmentEnum.getValue().equals(EquipmentEnum.AIR_CONDITIONING_UPS.getValue())) {
            return airConditioningUpsResolver;
        } else if(equipmentEnum.getValue().equals(EquipmentEnum.FRESH_AIR_UPS.getValue())) {
            return freshAirUpsResolver;
        }
        return null;
    }
}
